package com.sinitek.demo.report.controller;

import com.sinitek.common.support.RequestResult;
import com.sinitek.demo.report.entity.Administrator;
import com.sinitek.demo.report.service.IAdministratorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 王志华
 * @date 2021/7/2
 */
@RequestMapping("/demo/report")
@Api(tags = "报告接口")
@RestController
@Slf4j
public class ReportController {

    @Autowired
    private IAdministratorService administratorService;

    @GetMapping("/list-administrators")
    @ApiOperation("查询基金管理人")
    public RequestResult<List<Administrator>> listAdministrators() {
        List<Administrator> data = this.administratorService.findAdministrators();
        return RequestResult.success(data);
    }

    @GetMapping("/load-administrator")
    @ApiOperation("获取指定基金管理人")
    public RequestResult<Administrator> listAdministrators(@RequestParam("id") Long id) {
        Administrator data = this.administratorService.getAdministratorById(id);
        return RequestResult.success(data);
    }
}
